<?php

/**
 * Usuario form base class.
 *
 * @method Usuario getObject() Returns the current form's model object
 *
 * @package    auip
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUsuarioForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'email'     => new sfWidgetFormInputText(array('label' => 'Email:')),
      'nombre'    => new sfWidgetFormInputText(array('label' => 'Nombres:')),
      'apellidos' => new sfWidgetFormInputText(array('label' => 'Apellidos:')),
      'password'  => new sfWidgetFormInputPassword(array('label' => 'Contraseña:')),
      'password2'  => new sfWidgetFormInputPassword(array('label' => 'Confirmar Contraseña:'),array('maxlength' => 10)),
      'id_perfil' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Perfiles'), 'add_empty' => false)),
    ));

   $this->setValidators(array(
      'email'     => new sfValidatorEmail(),
      'nombre'    => new sfValidatorString(),
      'apellidos' => new sfValidatorString(),
      'password'  => new sfValidatorString(),	
      'password2' => new sfValidatorString(),		
      'id_perfil' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Perfiles'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('usuario[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Usuario';
  }

}
